home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / editor / auror300.zip / HELPMAC.AML < prev    next >
Text File  |  1996-07-17  |  3KB  |  115 lines

  1. //--------------------------------------------------------------------
  2. // HELPMAC.AML
  3. // Macro Help, (C) 1993-1996 by nuText Systems
  4. //
  5. // This macro displays .Dox help for macros in the Macro\ directory.
  6. //
  7. // Usage:
  8. //
  9. // This macro is intended for use as a utility by other macros, not as a
  10. // standalone macro. Helpmac is used by the 'helpmacro' function in
  11. // Ext.aml. When called from runmacro, arguments to this macro will be as
  12. // follows:
  13. //
  14. //   arg 1: the filename of this macro
  15. //   arg 2: the object name of this macro
  16. //   arg 3: the unqualified macro name
  17. //
  18. //--------------------------------------------------------------------
  19.  
  20. // compile time macros and function definitions
  21. include bootpath "define.aml"
  22.  
  23. // help window colors
  24. constant help_border_color        = color black on gray
  25. constant help_border_flash_color  = color brightgreen on gray
  26. constant help_north_title_color   = color black on gray
  27. constant help_text_color          = color cyan on black
  28. constant help_cursor_color        = color yellow on black
  29.  
  30. // this object inherits from the 'win' object
  31. settype "win"
  32.  
  33. macro = arg 3
  34.  
  35. // load the .Dox help file
  36. helpbuf = loadbuf (qualify (forceext macro "dox") (bootpath "macro"))
  37. if not helpbuf then
  38.   msgbox "No help available for " + macro
  39.   return
  40. end
  41.  
  42. lines = getlines
  43.  
  44. resident ON
  45.  
  46. // create the help window
  47. createwindow
  48. setframe ">b"
  49. setcolor  border_color        help_border_color
  50. setcolor  north_title_color   help_border_color
  51. setcolor  text_color          help_text_color
  52. setcolor  border_flash_color  help_border_flash_color
  53. settitle (onname (getname macro)) + " Help"
  54. setwinctrl "≡" 2
  55. setborder "1"
  56. setshadow 2 1
  57.  
  58. // center the window
  59. width  = 75
  60. height = getvidrows - 2
  61. if lines >= height then
  62.   setframe "+v"
  63. else
  64.   height = lines + 1
  65. end
  66. ox = (getvidcols - width) / 2
  67. oy = (getvidrows - height) / 2
  68. sizewindow ox oy ox + width oy + height "ad"
  69.  
  70. // attach cursor
  71. cursor = createcursor
  72. colorcursor help_cursor_color
  73. setwincurs cursor
  74. setsyntax 1 (onsyntax (getbufname))
  75.  
  76. // destroy window and buffer
  77. event <destroy>
  78.   // prevent close from adding buffer name to the history
  79.   setbufname '' helpbuf
  80.   close
  81.   destroybuf helpbuf
  82. end
  83.  
  84. function '≡'
  85.   destroyobject
  86. end
  87.  
  88. //--------------------------------------------------------------------
  89. // keys
  90. //--------------------------------------------------------------------
  91.  
  92. // cursor
  93. key <up>           up
  94. key <down>         down
  95. key <left>         rollcol -1
  96. key <right>        rollcol  1
  97. key <home>         col 1
  98.  
  99. // scrolling
  100. key <pgup>         pageup
  101. key <pgdn>         pagedown
  102. key <ctrl pgup>    row 1                // to list top
  103. key <ctrl pgdn>    row (getlines)       // to list bottom
  104. key <ctrl home>    row (getviewtop)     // to page top
  105. key <ctrl end>     row (getviewbot)     // to page bottom
  106.  
  107. // window functions
  108. key <ctrl z>       maximize
  109. key <shift f3>     tile 'v'             // tile vertical
  110. key <shift f4>     tile 'h'             // tile horizontal
  111. key <shift f5>     cascade              // cascade
  112.  
  113. // exit
  114. key <esc>          destroyobject
  115.